<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>Audit</title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
          name='viewport'/>
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/ready.css">
    <link rel="stylesheet" href="assets/css/demo.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="assets/layer/layer/theme/default/layer.css"/>
    <link rel="stylesheet" href="angularjs/pagination.css">
    <script src="../homePage/js/jquery-1.9.1/jquery.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <script src="layer/layer.js"></script>
    <script src="angularjs/angular.min.js"></script>
    <script src="angularjs/pagination.js"></script>
    <script>
        var app = angular.module("myApp", ['pagination']);
        app.controller("myCtrl", function ($scope, $http) {
            var admin = sessionStorage.getItem("admin");
            $scope.userid = JSON.parse(admin).userid;
            $scope.username = JSON.parse(admin).username;

            $scope.paginationConf = {
                currentPage: 1,//当前页，默认第一页
                itemsPerPage: 5,//每页显示条数，默认为5
                totalItems: 1000,//一共多少条，随查询数据更新
                perPageOptions: [2, 5, 10, 50],
                onChange: function () {
                    var reportno = $("#reportno").val();
                    //开始调用分页请求
                    $scope.reportnoSearch($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
                }
            };

            // //初始化数据请求
            // $scope.select = function () {
            //     $http.get("http://localhost:9001/report/firstReportPage").success(function (data) {
            //         $scope.list = data.rows;//更新页面数据
            //         $scope.paginationConf.totalItems = data.total;//更新总记录总条数
            //     });
            // };
            //分页请求
            $scope.select2 = function (pageIndex, pageSize) {
                //login = layer.load(1);
                $http.get("http://localhost:9001/report/getAllReportPage?pageIndex=" + pageIndex + "&pageSize=" + pageSize).success(function (data) {
                    $scope.list = data.rows;//更新页面数据
                    $scope.paginationConf.totalItems = data.total;//更新总记录总条数
                    // layer.close(login);
                });
            };
            //报案号查询
            $scope.reportstate = '待审核';
            $scope.reportnoSearch = function (pageIndex, pageSize) {
                var tReport = {
                    reportid: $scope.reportno,
                    reporttime: $scope.reporttime,
                    policynum: $scope.policynum,
                    reportstate: $scope.reportstate
                };

                $http.post("http://localhost:9001/report/getReportbyReportid?pageIndex=" + pageIndex + "&pageSize=" + pageSize, tReport)
                    .success(function (data) {
                        $scope.list = data.rows;
                        $scope.paginationConf.totalItems = data.total;//更新总记录总条数
                    })

            }
            $scope.search = function () {
                $scope.reportnoSearch($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
            }

            //修改前的查询
            $scope.audit = function (policynum) {
                $.ajax({
                    url: "http://localhost:9001/policy/getReportbyNum",
                    data: {
                        firstid: sessionStorage.getItem("admin").userid,
                        policynum: policynum
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        layer.msg(res.msg);
                        $scope.reportnoSearch($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
                    }
                })
            }
            //退出登陆
            $scope.quiet = function () {
                sessionStorage.clear();
                window.location.href = "../adminLogin/login.html";
            }
        })
    </script>
</head>
<style type="text/css">
    .main-panel {
        background-color: #FFFFFF !important;
    }

    .content {
        background-color: #FFFFFF !important;
    }
</style>

<body ng-app="myApp" ng-controller="myCtrl" ng-init="select()">
<div class="wrapper">
    <div class="main-header">
        <div class="logo-header">
            <a href="Audit.html" class="logo">
                <img src="../pay/img/logo.png" style="height: 40px;width: 100px">审核部
            </a>
            <button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse"
                    data-target="collapse"
                    aria-controls="sidebar" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <button class="topbar-toggler more"><i class="la la-ellipsis-v"></i></button>
        </div>
        <nav class="navbar navbar-header navbar-expand-lg float-right">
            <div class="container-fluid ">
                <ul class="navbar-nav topbar-nav ml-md-auto align-items-center">


                    <li class="nav-item dropdown">
                        <a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#" aria-expanded="false">
                            <span  ng-value="$scope.username">{{username}}</span>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li>
                                <div class="user-box">
                                    <div class="u-text">
                                        <button ng-click="quiet()" class="btn btn-rounded btn-danger btn-sm">退出登录</button>
                                    </div>
                                </div>
                            </li>

                        </ul>
                        <!-- /.dropdown-user -->
                    </li>
                </ul>
            </div>
        </nav>
    </div>
    <!--    <div class="main-header">
            <div class="logo-header">
                <a href="Audit.html" class="logo">
                    <img src="../pay/img/logo.png" style="height: 40px;width: 100px">审核部
                </a>
                <button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse"
                        data-target="collapse"
                        aria-controls="sidebar" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <button class="topbar-toggler more"><i class="la la-ellipsis-v"></i></button>
            </div>
            <nav class="navbar navbar-header navbar-expand-lg">
                <div class="container-fluid">
                    <a href="../homePage/index.html" style="color: #000000; font-size: 16px;">返回首页</a>

                    <ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
                        <li class="nav-item dropdown">
                            <a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#" aria-expanded="false">
                                <span>当前用户: &nbsp;{{user.username}}</span>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li>
                                    <div class="user-box">
                                        <div class="u-text">
                                            <h4>{{user.username}}</h4>
                                            <p class="text-muted">{{user.email}}</p>
                                            <a ng-click="quiet()" class="btn btn-rounded btn-danger btn-sm">退出登录</a>
                                        </div>
                                    </div>
                                </li>

                            </ul>
                            &lt;!&ndash; /.dropdown-user &ndash;&gt;
                        </li>
                    </ul>
                </div>
            </nav>
        </div>-->
    <div class="sidebar">
        <div class="scrollbar-inner sidebar-wrapper">

            <ul class="nav">
                <li class="nav-item active">
                    <a href="Audit.html">
                        <i class="la la-fonticons"></i>
                        <p>审核订单</p>
                        <span class="badge badge-count">初审</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="recheck.html">
                        <i class="la la-fonticons"></i>
                        <p>审核订单</p>
                        <span class="badge badge-count">复审</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="main-panel">
        <div class="content">
            <div class=" card col-md-11">
                <div class="panel panel-info">
                    <div class="card card-header">
                        <h2>审核订单（初审）</h2>
                    </div>
                    <div class="panel panel-body">
                        <div class="form-inline">
                            <button class="btn btn-success" ng-click="search()">查询</button>
                            <label>报案号：</label><input ng-model="reportno" class="form-control">
                            <label>报案时间：</label><input ng-model="reporttime" type="date" class="form-control">
                            <label>保单号：</label><input ng-model="policynum" class="form-control">
                        </div>
                        <br/>
                        <table class="table table-hover table-bordered table-condensed table-striped text-center">
                            <tr>
                                <td>序号</td>
                                <td>报案号</td>
                                <td>保单号</td>
                                <td>报案时间</td>
                                <td>最后修改时间</td>
                                <td>理赔单状态</td>
                                <td>勘查人员id</td>
                                <td>审核人员id</td>
                                <td>赔付金额</td>
                                <td>定损人员id</td>
                                <td>备注</td>
                                <td>操作</td>
                            </tr>
                            <tr ng-repeat="c in list">
                                <td ng-bind="$index+1"></td>
                                <td>{{c.reportid}}</td>
                                <td>{{c.policynum}}</td>
                                <td>{{c.reporttime | date:'yyyy-MM-dd'}}</td>
                                <td>{{c.lastmodifytime | date:'yyyy-MM-dd'}}</td>
                                <td>{{c.reportstate}}</td>
                                <td>{{c.surveyorid}}</td>
                                <td>{{c.firstid}}</td>
                                <td>{{c.money}}</td>
                                <td>{{c.secondid}}</td>
                                <td>{{c.remark}}</td>
                                <td>
                                    <button ng-click="audit(c.policynum)" class="btn btn-info">审核
                                    </button>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="12">
                                    <tm-pagination conf="paginationConf"></tm-pagination>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>


</html>
